import { request } from '@/utils/request'
import qs from 'qs'

/**
 * 帐号登录
 * @param {String} account - 用户名
 * @param {String} password - 密码
 * @returns Promise
 */

// 登录
export const userAccountLogin = data => {
  return request('/user/doLogin', 'get', data)
}
// 获取用户信息
export const userInfo = data => {
  return request('/user/login', 'get', data,{ 'Content-Type': 'application/json' })
}
// 修改用户信息
export const setUserInfo = data => {
  return request('/user/update', 'post', data,{ 'Content-Type': 'application/json' })
}
// 用户购物车
export const queryGoodsUser = data => {
  return request('/cart/queryGoodsByUserId', 'get', data)
}
// 修改单个商品数量
export const getUserInfo = () => {
  return request('user/currentuser.do', 'get')
}
// 修改密码
export const updataPass = data => {
  return request('user/changepwd.do', 'post', qs.stringify(data))
}
// 查询省
export const queryProvinces = () => {
  return request('area/queryprovinces.do', 'GET')
}

// 查询城市
export const queryCities = data => {
  return request('area/querycities.do', 'post', qs.stringify(data))
} // 发布评论
export const sendComment = data => {
  return request('comments/sendcomment.do', 'post', qs.stringify(data))
}
// 添加收货地址, {/address/selectAddress
    // 'Content-Type': 'application/json'
  // }
export const addAddress = data => {
  return request('/address/addAddress', 'post', data)
}

//获取收货地址
 // }
 export const selectAddress = data => {
  return request('/address/selectAddress', 'get', data)
}
// 刪除收貨地址
export const deleteAddressById = data => {
 return request('/address/deleteAddressById', 'get', data)
}
// 編輯收貨地址
export const updateAddress = data => {
  return request('/address/updateAddress', 'post', data)
 }